package com.hmall.order;

import com.hmall.common.client.AddressClient;
import com.hmall.common.client.ItemClient;
import com.hmall.common.client.UserClient;
import com.hmall.order.config.SnowflakeIdGenerator;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

@MapperScan("com.hmall.order.mapper")
@SpringBootApplication
@EnableFeignClients(clients = {ItemClient.class, AddressClient.class,UserClient.class})
//@EnableFeignClients(clients = ItemClient.class)
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    @Bean
    public SnowflakeIdGenerator autoSnowflakeIdGenerator(){
        return new SnowflakeIdGenerator(3L,10L);
    }

    @Bean
    public MessageConverter jsonMessageConverter(){
        return new Jackson2JsonMessageConverter();
    }

}